﻿using UnityEngine;
using System.Collections;

public class Bouncer : MonoBehaviour {
	void OnTriggerEnter2D (Collider2D other)
	{
		// If the player enters the trigger zone...
		if(other.tag == "Player")
		{
			Rigidbody2D p = other.rigidbody2D;
			Vector2 diff = p.transform.position - this.rigidbody2D.transform.position;
			p.velocity = diff * 10;
		}
	}
}
